$ss()
Syntax
Arguments
- ELEMENTDOM ElementstringDOM Element Array
The element(s) to assign the style attributes. Can be a single DOM element, an element ID specified as a string, or an array of DOM Element objects. If specifying the ID as a string, the ID corresponds to the value for the id HTML attribute for the element you wish to assign a style.
- STYLEJSON
An object of name-value pairs defining the style attributes to assign to the element(s).
Description
The $ss() function sets the in-line style of the passed-in element(s). It takes a second parameter of a JSON (Javascript Object Notation) object of the style attributes to set.
Discussion
The $ss() function can be used to assign in-line styles to HTML elements. For example:
/*Set the control's font family and font weight.*/ $ss('firstname',{fontFamily: 'arial', fontWeight: 'bold'}); /**/
The $ss() function is a shortcut for getting a pointer to an HTML DOM element and setting the style attributes. The example above could be rewritten using the [$()] method as follows:
var ele = $('firstname'); ele.style.fontFamily = 'arial'; ele.style.fontWeight = 'bold';
See Also